//
//  Match.m
//  AOEProject
//
//  Created by techplus on 9/20/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "Match.h"
#import "Game.h"
#import "AOE_XML_Parser.h"

@implementation Match
@synthesize atrTitle;
@synthesize atrDate;
@synthesize atrType;
@synthesize games;

@synthesize TAG_CATALOG_INDEX;
@synthesize TAG_CATALOG_ELEMENT_INDEX;
@synthesize TAG_MATCH_INDEX;

-(id)initWithCatalogIndex:(NSInteger *)cIndex ceIndex:(NSInteger *)ceIndex matchIndex:(NSInteger *)mIndex;
{
    self = [super init];
    if(self)
    {
        self.TAG_CATALOG_INDEX = cIndex;
        self.TAG_CATALOG_ELEMENT_INDEX = ceIndex;
        self.TAG_MATCH_INDEX = mIndex;
        //[self getAtrs];
    }
    return self;
}

-(void)getAtrs{
    //SAMPLE DATA
    atrTitle = [[NSString alloc]initWithFormat:@"C %d CE%d M %d",TAG_CATALOG_INDEX,TAG_CATALOG_ELEMENT_INDEX,TAG_MATCH_INDEX];
    atrDate = @"12/31989";
    atrType = @"Giao hữu";
}

-(void)getGames{
    self.games = [[NSMutableArray alloc]initWithArray:[[AOE_XML_Parser getInstance]getGameList:TAG_CATALOG_INDEX :TAG_CATALOG_ELEMENT_INDEX :TAG_MATCH_INDEX]];
}

-(void)dealloc{
    [atrTitle release];
    [atrDate release];
    [atrType release];
    
    TAG_CATALOG_INDEX = nil;
    TAG_CATALOG_ELEMENT_INDEX = nil;
    TAG_MATCH_INDEX = nil;
    
    [games release];
    [super dealloc];
}

@end
